<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <div>
      <div id="app1"></div>
      <div id="app2"></div>
      <div id="app3"></div>
    </div>
    <script src="../utils/js/old_version/react.development.js"></script>
    <script src="../utils/js/old_version/react-dom.development.js"></script>
    <script src="../utils/js/old_version/prop-types.js"></script>
    <script src="../utils/js/old_version/babel.min.js"></script>
    <script type="text/babel">
      class Person extends React.Component {
        constructor(props) {
          super();
          console.log(props, ":::const");
        }

        render() {
          const { name, age, sex } = this.props;
          console.log(this.props, ":::");
          return (
            <ul>
              <li> name: {name}</li>
              <li> age: {age + 1}</li>
              <li> sex: {sex}</li>
            </ul>
          );
        }

        static propTypes = {
          name: PropTypes.string.isRequired,
          age: PropTypes.number,
          sex: PropTypes.string,
          speak: PropTypes.func, // 设置函数 用 func
        };

        static defaultProps = {
          sex: "不男不女",
        };
      }

      ReactDOM.render(
        <Person name="juser" age={18} />,
        document.getElementById("app1")
      );
    </script>
  </body>
</html>
